package com.topvision.bureau.view.regmode;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.kernal.demo.plateid.R;
import com.topvision.bureau.model.regmode.RegMode;

/**
 * 识别模式Fragment
 * User: jack(jackgu@topvision-cv.com)
 * Date: 2017-06-16
 * Time: 18:46
 */
public class RegModeFragment extends Fragment {
    public static final String REG_MODE= "REG_MODE";

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_reg_mode, container, false);
        ImageView regPic = (ImageView) view.findViewById(R.id.reg_pic);
        TextView regName = (TextView) view.findViewById(R.id.reg_name);
        Bundle bundle = getArguments();
        final RegMode regMode = bundle.getParcelable(REG_MODE);
        regName.setText(regMode.getRegName());
        regPic.setImageResource(regMode.getRegPic());
        return view;
    }

    public static RegModeFragment newInstance(RegMode regMode) {
        RegModeFragment fragment = new RegModeFragment();
        Bundle bundle = new Bundle();
        bundle.putParcelable(REG_MODE, regMode);
        fragment.setArguments(bundle);
        return fragment;
    }
}